prices = [7, 1, 5, 3, 6, 4]
# 7

# 当前的数字
origin_num = prices[0]
result = 0

for i in range(len(prices) - 1):
    if prices[i + 1] - prices[i] > 0:
        result = result + prices[i + 1] - prices[i]

print(result)
